#ifndef _TOUCHSCREEN_H_
#define _TOUCHSCREEN_H_



typedef struct _TSPOINT
{
	WORD x;
	WORD y;
} TSPOINT;



//EVB
#ifdef TW8823EVB
#define DEF_XOFF (1557L)
#define DEF_YOFF (36526L)
#define	DEF_XSLOPE (47)
#define DEF_YSLOPE (-72)
#endif

//SH-DEMO
#ifdef TW8823SHDEMO
#ifdef TW8823INNOLUX
#define DEF_XOFF (38030L)
#define DEF_YOFF (2200L)
#define	DEF_XSLOPE (-46)
#define DEF_YSLOPE (70)
#endif
#ifdef TW8823HANSTAR
#define DEF_XOFF (38090L)
#define DEF_YOFF (5116L)
#define	DEF_XSLOPE (-46)
#define DEF_YSLOPE (60)
#endif
#endif

#define DEF_XRES 800
#define DEF_YRES 480

//Touch Screen status
#define TOUCH_PRESS 0  //from TOUCH_NORMAL to TOUCH_DOWN
#define TOUCH_POPUP 1  //from TOUCH_DOWN to TOUCH_NORMAL
#define TOUCH_HOLD 0xD
#define TOUCH_IDLE 0xE
#define TOUCH_CLOSED 0xF

// Touch Int Routing
BYTE IntTouch(void);	//For Touch Int

// Touch main loop 
void InitTSC(void);
void GetTouchInfo(TSPOINT *Point, BYTE *State);

// Adj Touch
void CalSlopeOff(U16 adc0, U16 adc1, U16 scr0, U16 scr1, S8* slope, LONG* off);
U16 ADC2SCR(U16 adc, S8 slope, LONG off);



#endif
